CanModify vs isEdit

I need to modify few attributes and need exclusive edit access for the target module. Before I try to open the module in exclusive edit mode, I need to check that I have adequate access for the target module. if I don't have enough access, I want to skip the module.
I get module full path from a GUI.

Why I get "no access" in the following code. What I am doing wrong?
Is there any other way to check adequate access for a module.

for pos in modListDBE do
{
string modName = getColumnValue(modListDBE, pos, 2) "/" getColumnValue
(modListDBE, pos, 0)

//full path looks like this
// modName="/Project/module name"

destMod = read(modName,false)
if(canModify( destMod))
{
destMod = edit(modName, false)
print "have access\n"
}
else
{
print "no access\n"
continue
}
}
faisal.zahidi@boeing.com - Fri Jun 11 21:16:10 EDT 2010

Re: CanModify vs isEdit
faisal.zahidi@boeing.com - Fri Jun 11 21:23:10 EDT 2010

In addition to that I have RMCDA access for each module.

Re: CanModify vs isEdit
a_vestlin - Mon Jun 14 02:17:42 EDT 2010

faisal.zahidi@boeing.com - Fri Jun 11 21:23:10 EDT 2010
In addition to that I have RMCDA access for each module.

The 'bool canModify(Module m)' perm tells you if you can modify the module right now.
You need to open the module in Edit Exclusive mode before you make this check.

An alternative is to use the 'Module edit(string s, bool visible, bool dontAsk)' perm
instead,

edit(module_name, false, true)


will only open the module in edit mode if it is possible.

If you really like to determine if you have the right access rights you should use the
'hasPermission(string username, Module m, Permission p)' perm. For example:

 

string user = doorsname
Module m = current
print hasPermission(user, m, modify)


/Anders

 

Re: CanModify vs isEdit
llandale - Tue Jun 15 14:04:57 EDT 2010

a_vestlin - Mon Jun 14 02:17:42 EDT 2010

The 'bool canModify(Module m)' perm tells you if you can modify the module right now.
You need to open the module in Edit Exclusive mode before you make this check.

An alternative is to use the 'Module edit(string s, bool visible, bool dontAsk)' perm
instead,

edit(module_name, false, true)


will only open the module in edit mode if it is possible.

If you really like to determine if you have the right access rights you should use the
'hasPermission(string username, Module m, Permission p)' perm. For example:

 

string user = doorsname
Module m = current
print hasPermission(user, m, modify)


/Anders

 

yes.

I routinely do this:

Module mod = edit(NameModFull, false, true)
if (null mod)        log cannot open module
elseif(!isEdit(mod)) log cannot edit module; close(mod)
else                 deal with edited mod; save(mod); close(mod)


Don't use 'hasPermission' much, just open module edit and check canModify().

 

 

  • Louie

 

 

Re: CanModify vs isEdit
faisal.zahidi@boeing.com - Tue Aug 03 15:12:43 EDT 2010

llandale - Tue Jun 15 14:04:57 EDT 2010

yes.

I routinely do this:

Module mod = edit(NameModFull, false, true)
if (null mod)        log cannot open module
elseif(!isEdit(mod)) log cannot edit module; close(mod)
else                 deal with edited mod; save(mod); close(mod)


Don't use 'hasPermission' much, just open module edit and check canModify().

 

 

  • Louie

 

 

Louie

Thank you so much. Works!

FZ

Re: CanModify vs isEdit
Malcolm.Cetera - Fri Nov 19 23:20:39 EST 2010

a_vestlin wrote:
The 'bool canModify(Module m)' perm tells you if you can modify the module right now.
You need to open the module in Edit Exclusive mode before you make this check.

An alternative is to use the 'Module edit(string s, bool visible, bool dontAsk)' perm
instead,
edit(module_name, false, true)

will only open the module in edit mode if it is possible.

If you really like to determine if you have the right access rights you should use the
'hasPermission(string username, Module m, Permission p)' perm. For example:
string user = doorsname

Module m = current

print hasPermission(user, m, modify)

/Anders


It is just the solution for my problem, Thanks for your instruction!

Re: CanModify vs isEdit
llandale - Tue Nov 23 13:23:25 EST 2010

Don't forget, that just because you 'canModify(mod)' doesn't mean you 'canModify(ad)' each attribute.